<!DOCTYPE html>












  


<html class="theme-next pisces use-motion" lang="zh-CN">
<head><meta name="generator" content="Hexo 3.9.0">
  <meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2">
<meta name="theme-color" content="#222">












  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png?v=7.2.0">


  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32-next.png?v=7.2.0">


  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16-next.png?v=7.2.0">


  <link rel="mask-icon" href="/images/logo.svg?v=7.2.0" color="#222">






<link rel="stylesheet" href="/css/main.css?v=7.2.0">






<link rel="stylesheet" href="/lib/font-awesome/css/font-awesome.min.css?v=4.7.0">






  
  
  <link rel="stylesheet" href="/lib/fancybox/source/jquery.fancybox.css">



<script id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/',
    scheme: 'Pisces',
    version: '7.2.0',
    sidebar: {"position":"left","display":"post","offset":12,"onmobile":false},
    back2top: {"enable":true,"sidebar":false,"scrollpercent":true},
    copycode: {"enable":true,"show_result":true,"style":null},
    fancybox: true,
    mediumzoom: false,
    lazyload: false,
    pangu: false,
    algolia: {
      applicationID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    },
    localsearch: {"enable":true,"trigger":"auto","top_n_per_article":1,"unescape":false,"preload":false},
    search: {
      root: '/',
      path: 'search.xml'
    },
    tabs: true,
    motion: {"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},
    translation: {
      copy_button: '复制',
      copy_success: '复制成功',
      copy_failure: '复制失败'
    }
  };
</script>

  <meta name="description" content="okIconokIcon是一个自动获取阿里iconfont的一个助手，只需要第一次使用安装是初始化，后续一个命令自动下载释放。 使用的模块fs node自带 文件库fs-extra 第三方文件库commander 命令行指令解决方案模块inquirer 命令行交互模块request 网络访问库log-symbols 命令行输出图标chalk 命令行文字颜色cross-spawn 跨平台shell执">
<meta name="keywords" content="cli,npm,iconfont">
<meta property="og:type" content="article">
<meta property="og:title" content="okcoin-cli 辅助">
<meta property="og:url" content="https://blog.youngzk.com/posts/5da3d5f3/index.html">
<meta property="og:site_name" content="Muniz Blog">
<meta property="og:description" content="okIconokIcon是一个自动获取阿里iconfont的一个助手，只需要第一次使用安装是初始化，后续一个命令自动下载释放。 使用的模块fs node自带 文件库fs-extra 第三方文件库commander 命令行指令解决方案模块inquirer 命令行交互模块request 网络访问库log-symbols 命令行输出图标chalk 命令行文字颜色cross-spawn 跨平台shell执">
<meta property="og:locale" content="zh-CN">
<meta property="og:updated_time" content="2019-07-28T05:22:54.720Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="okcoin-cli 辅助">
<meta name="twitter:description" content="okIconokIcon是一个自动获取阿里iconfont的一个助手，只需要第一次使用安装是初始化，后续一个命令自动下载释放。 使用的模块fs node自带 文件库fs-extra 第三方文件库commander 命令行指令解决方案模块inquirer 命令行交互模块request 网络访问库log-symbols 命令行输出图标chalk 命令行文字颜色cross-spawn 跨平台shell执">





  
  
  <link rel="canonical" href="https://blog.youngzk.com/posts/5da3d5f3/">



<script id="page.configurations">
  CONFIG.page = {
    sidebar: "",
  };
</script>

  
  <title>okcoin-cli 辅助 | Muniz Blog</title>
  






  <script>
    var _hmt = _hmt || [];
    (function() {
      var hm = document.createElement("script");
      hm.src = "https://hm.baidu.com/hm.js?502753d7b083822cd84ffc61132a5ac4";
      var s = document.getElementsByTagName("script")[0];
      s.parentNode.insertBefore(hm, s);
    })();
  </script>







  <noscript>
  <style>
  .use-motion .motion-element,
  .use-motion .brand,
  .use-motion .menu-item,
  .sidebar-inner,
  .use-motion .post-block,
  .use-motion .pagination,
  .use-motion .comments,
  .use-motion .post-header,
  .use-motion .post-body,
  .use-motion .collection-title { opacity: initial; }

  .use-motion .logo,
  .use-motion .site-title,
  .use-motion .site-subtitle {
    opacity: initial;
    top: initial;
  }

  .use-motion .logo-line-before i { left: initial; }
  .use-motion .logo-line-after i { right: initial; }
  </style>
</noscript>

</head>

<body itemscope itemtype="http://schema.org/WebPage" lang="zh-CN">

  
  
    
  

  <div class="container sidebar-position-left page-post-detail">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-wrapper">
  <div class="site-meta">
    

    <div class="custom-logo-site-title">
      <a href="/" class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">Muniz Blog</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
    
    
  </div>

  <div class="site-nav-toggle">
    <button aria-label="切换导航栏">
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>



<nav class="site-nav">
  
    <ul id="menu" class="menu">
      
        
        
        
          
          <li class="menu-item menu-item-home">

    
    
      
    

    

    <a href="/" rel="section"><i class="menu-item-icon fa fa-fw fa-home"></i> <br>首页</a>

  </li>
        
        
        
          
          <li class="menu-item menu-item-books">

    
    
      
    

    

    <a href="/books" rel="section"><i class="menu-item-icon fa fa-fw fa-question-circle"></i> <br>阅读</a>

  </li>
        
        
        
          
          <li class="menu-item menu-item-tags">

    
    
      
    

    

    <a href="/tags/" rel="section"><i class="menu-item-icon fa fa-fw fa-tags"></i> <br>标签</a>

  </li>
        
        
        
          
          <li class="menu-item menu-item-categories">

    
    
      
    

    

    <a href="/categories/" rel="section"><i class="menu-item-icon fa fa-fw fa-th"></i> <br>分类</a>

  </li>
        
        
        
          
          <li class="menu-item menu-item-archives">

    
    
      
    

    

    <a href="/archives/" rel="section"><i class="menu-item-icon fa fa-fw fa-archive"></i> <br>归档</a>

  </li>

      
      
        <li class="menu-item menu-item-search">
          <a href="javascript:;" class="popup-trigger">
          
            <i class="menu-item-icon fa fa-search fa-fw"></i> <br>搜索</a>
        </li>
      
    </ul>
  

  

  
    <div class="site-search">
      
  <div class="popup search-popup local-search-popup">
  <div class="local-search-header clearfix">
    <span class="search-icon">
      <i class="fa fa-search"></i>
    </span>
    <span class="popup-btn-close">
      <i class="fa fa-times-circle"></i>
    </span>
    <div class="local-search-input-wrapper">
      <input autocomplete="off" placeholder="搜索..." spellcheck="false" type="text" id="local-search-input">
    </div>
  </div>
  <div id="local-search-result"></div>
</div>



    </div>
  
</nav>



</div>
    </header>

    


    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          
            

          
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
      

  
  
  

  

  <article class="post post-type-normal" itemscope itemtype="http://schema.org/Article">
  
  
  
  <div class="post-block">
    <link itemprop="mainEntityOfPage" href="https://blog.youngzk.com/posts/5da3d5f3/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content="修心">
      <meta itemprop="description" content="修不被别人影响的心，修不被自己控制的心，修不被别人诱惑的心。">
      <meta itemprop="image" content="/images/avatar.jpg">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="Muniz Blog">
    </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">okcoin-cli 辅助

              
            
          </h1>
        

        <div class="post-meta">

          
          
          

          
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">发表于</span>
              

              
                
              

              <time title="创建时间：2018-12-09 13:17:34" itemprop="dateCreated datePublished" datetime="2018-12-09T13:17:34+08:00">2018-12-09</time>
            </span>
          

          
            

            
              <span class="post-meta-item">
                <span class="post-meta-item-icon">
                  <i class="fa fa-calendar-check-o"></i>
                </span>
                
                  <span class="post-meta-item-text">更新于</span>
                
                <time title="修改时间：2019-07-28 13:22:54" itemprop="dateModified" datetime="2019-07-28T13:22:54+08:00">2019-07-28</time>
              </span>
            
          

          

          
          

          
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="fa fa-eye"></i>
                 阅读次数： 
                <span class="busuanzi-value" id="busuanzi_value_page_pv"></span>
              </span>
            </span>
          

          

          <br>
          

          

          

        </div>
      </header>
    

    
    
    
    <div class="post-body" itemprop="articleBody">

      
      

      
        <h3 id="okIcon"><a href="#okIcon" class="headerlink" title="okIcon"></a><a href="https://github.com/1160007652/okIcon" target="_blank" rel="noopener">okIcon</a></h3><p><a href="https://github.com/1160007652/okIcon" target="_blank" rel="noopener">okIcon</a>是一个自动获取阿里iconfont的一个助手，只需要第一次使用安装是初始化，后续一个命令自动下载释放。</p>
<h4 id="使用的模块"><a href="#使用的模块" class="headerlink" title="使用的模块"></a>使用的模块</h4><p>fs node自带 文件库<br><a href="https://www.npmjs.com/package/fs-extra" target="_blank" rel="noopener">fs-extra</a> 第三方文件库<br><a href="https://www.npmjs.com/package/commander" target="_blank" rel="noopener">commander</a> 命令行指令解决方案模块<br><a href="https://www.npmjs.com/package/inquirer" target="_blank" rel="noopener">inquirer</a> 命令行交互模块<br><a href="https://www.npmjs.com/package/request" target="_blank" rel="noopener">request</a> 网络访问库<br><a href="https://www.npmjs.com/package/log-symbols" target="_blank" rel="noopener">log-symbols</a> 命令行输出图标<br><a href="https://www.npmjs.com/package/chalk" target="_blank" rel="noopener">chalk</a> 命令行文字颜色<br><a href="https://www.npmjs.com/package/cross-spawn" target="_blank" rel="noopener">cross-spawn</a> 跨平台shell执行<br><a href="https://www.npmjs.com/package/walk" target="_blank" rel="noopener">walk</a> 目录、文件遍历库</p>
<a id="more"></a>

<h3 id="制作okcoin"><a href="#制作okcoin" class="headerlink" title="制作okcoin"></a>制作okcoin</h3><h4 id="接收命令行参数"><a href="#接收命令行参数" class="headerlink" title="接收命令行参数"></a>接收命令行参数</h4><p>如： npm init -y ,这里 init -y 就是执行命令是传入的参数，每个参数都是空格隔开的。<br>如下代码，我定义了4个指令， 分别是 -v -i -d –help , 对应的指令对应相应的函数去执行不同的功能。-v是查看版本、-i初始化、-d下载是否文件、- -help 查看帮助。</p>
<figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br></pre></td><td class="code"><pre><span class="line">program.version(<span class="string">'1.0.0'</span>, <span class="string">'-v, --version'</span>)</span><br><span class="line">    .option(<span class="string">'-i, --init'</span>, <span class="string">'初始化配置文件'</span>)</span><br><span class="line">    .option(<span class="string">'-d, --download'</span>, <span class="string">'下载iconfont文件'</span>)</span><br><span class="line">    .description(<span class="string">'自动下载IconFont助手'</span>);</span><br><span class="line"></span><br><span class="line">program.on(<span class="string">'--help'</span>, <span class="function"><span class="keyword">function</span>(<span class="params"></span>)</span>&#123;</span><br><span class="line">    <span class="built_in">console</span>.log(<span class="string">'\n-------------------------------------\n'</span>);</span><br><span class="line">    <span class="built_in">console</span>.log(<span class="string">'先使用 okIcon -i 进行初始化\n'</span>);</span><br><span class="line">    <span class="built_in">console</span>.log(<span class="string">"后续iconfont的改动，使用 okIcon -d 进行下载\n"</span>);</span><br><span class="line">&#125;);</span><br><span class="line">    </span><br><span class="line">program.parse(process.argv);</span><br></pre></td></tr></table></figure>

<h4 id="交互式操作"><a href="#交互式操作" class="headerlink" title="交互式操作"></a>交互式操作</h4><p>如果执行了指令 <strong>-i</strong> ,那么就会触发inquirer方法。提示用户输入对应的信息。做初始化配置作用！</p>
<figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">if</span>(program.init)&#123;</span><br><span class="line">    inquirer.prompt([&#123;</span><br><span class="line">        type: <span class="string">'input'</span>,</span><br><span class="line">        name: <span class="string">'iconAddr'</span>,</span><br><span class="line">        message: <span class="string">'请输入iconfont的项目下载地址:\n'</span></span><br><span class="line">    &#125;,</span><br><span class="line">    &#123;</span><br><span class="line">        type: <span class="string">'input'</span>,</span><br><span class="line">        name: <span class="string">'iconCookies'</span>,</span><br><span class="line">        message: <span class="string">'请输入iconfont的Cookies:\n'</span></span><br><span class="line">    &#125;,</span><br><span class="line">    &#123;</span><br><span class="line">        type: <span class="string">'input'</span>,</span><br><span class="line">        name: <span class="string">'iconPath'</span>,</span><br><span class="line">        message: <span class="string">'请输入保存iconfont的绝对路径:\n'</span></span><br><span class="line">    &#125;]).then(<span class="function">(<span class="params">answers</span>) =&gt;</span> &#123;</span><br><span class="line">        <span class="keyword">const</span> &#123;iconAddr,iconCookies,iconPath&#125; = answers;</span><br><span class="line">        <span class="keyword">if</span>(setIconInfo(iconAddr,iconCookies,iconPath))&#123;</span><br><span class="line">            <span class="built_in">console</span>.log(logSymbols.success, chalk.green(<span class="string">'设置完毕，开始下载'</span>));</span><br><span class="line">            getIconfont();</span><br><span class="line">        &#125; <span class="keyword">else</span> &#123;</span><br><span class="line">            <span class="built_in">console</span>.log(logSymbols.error, chalk.red(<span class="string">'设置失败,再试一次'</span>));</span><br><span class="line">        &#125;</span><br><span class="line">    &#125;);</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<h4 id="ruquest携带自定义cookie"><a href="#ruquest携带自定义cookie" class="headerlink" title="ruquest携带自定义cookie"></a>ruquest携带自定义cookie</h4><p>封装request请求为同步方法，至于怎么传入cookie,都放到hearders字断中即可。完了使用pipe管道释放iconfont字节集数据到对应的目录即可。</p>
<figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br></pre></td><td class="code"><pre><span class="line"><span class="function"><span class="keyword">function</span> <span class="title">requestSync</span>(<span class="params">url, cookies</span>) </span>&#123;</span><br><span class="line">    <span class="keyword">return</span> <span class="keyword">new</span> <span class="built_in">Promise</span>(<span class="function"><span class="keyword">function</span>(<span class="params">resolve, reject</span>)</span>&#123;</span><br><span class="line">        <span class="keyword">let</span> options = &#123;</span><br><span class="line">            url: url,</span><br><span class="line">            headers: &#123;</span><br><span class="line">            <span class="string">'User-Agent'</span>: <span class="string">`Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36`</span>,</span><br><span class="line">            Cookie: cookies</span><br><span class="line">            &#125;</span><br><span class="line">        &#125;;</span><br><span class="line"></span><br><span class="line">        request(options,<span class="function"><span class="keyword">function</span>(<span class="params">e,r,b</span>)</span>&#123;</span><br><span class="line">            <span class="keyword">if</span>(e)&#123;</span><br><span class="line">                reject(e);</span><br><span class="line">            &#125;<span class="keyword">else</span>&#123;</span><br><span class="line">                resolve(b);</span><br><span class="line">            &#125;</span><br><span class="line">        &#125;).pipe(fs.createWriteStream(<span class="string">`<span class="subst">$&#123;__dirname&#125;</span>/../iconfont.zip`</span>));</span><br><span class="line">    &#125;);</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<h4 id="文件遍历封装"><a href="#文件遍历封装" class="headerlink" title="文件遍历封装"></a>文件遍历封装</h4><p>其实也不能说是封装，主要是说下这个walker库。<br>walk.walk(); 要传入遍历查询的根目录。返回一个 walker执行对象。<br>剩下的只需要 walker.on(‘事件’,（root, fileStats, next); 这个模块还是设计比较舒服的。有koa 洋葱模型的思想。fileStatus 是遍历处文件的一系列信息，next()执行下一个。</p>
<figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br></pre></td><td class="code"><pre><span class="line"><span class="function"><span class="keyword">function</span> <span class="title">moveIconfont</span>(<span class="params">iconPath</span>)</span>&#123;</span><br><span class="line">    <span class="keyword">const</span> walker = walk.walk(<span class="string">`<span class="subst">$&#123;__dirname&#125;</span>/../temp`</span>);</span><br><span class="line">    <span class="keyword">const</span> iconFiles = [<span class="string">'iconfont.css'</span>, <span class="string">'iconfont.eot'</span>, <span class="string">'iconfont.js'</span>, <span class="string">'iconfont.svg'</span>, <span class="string">'iconfont.ttf'</span>, <span class="string">'iconfont.woff'</span>];</span><br><span class="line">    walker.on(<span class="string">"file"</span>, <span class="function"><span class="keyword">function</span>(<span class="params">root, fileStats, next</span>)</span>&#123;</span><br><span class="line">        <span class="keyword">if</span> (iconFiles.includes(fileStats.name))&#123;</span><br><span class="line">            fse.moveSync(<span class="string">`<span class="subst">$&#123;root&#125;</span>/<span class="subst">$&#123;fileStats.name&#125;</span>`</span>, <span class="string">`<span class="subst">$&#123;iconPath&#125;</span>/<span class="subst">$&#123;fileStats.name&#125;</span>`</span>, &#123; <span class="attr">overwrite</span>: <span class="literal">true</span> &#125;);</span><br><span class="line">        &#125;</span><br><span class="line">        next();</span><br><span class="line">    &#125;);</span><br><span class="line"></span><br><span class="line">    walker.on(<span class="string">"errors"</span>, <span class="function"><span class="keyword">function</span> (<span class="params">root, nodeStatsArray, next</span>) </span>&#123;</span><br><span class="line">        next();</span><br><span class="line">    &#125;);</span><br><span class="line">    </span><br><span class="line">    walker.on(<span class="string">"end"</span>, <span class="function"><span class="keyword">function</span> (<span class="params"></span>) </span>&#123;</span><br><span class="line">        <span class="built_in">console</span>.log(logSymbols.success, chalk.green(<span class="string">"下载完毕"</span>));</span><br><span class="line">        fse.removeSync(<span class="string">`<span class="subst">$&#123;__dirname&#125;</span>/../temp`</span>);</span><br><span class="line">        fse.removeSync(<span class="string">`<span class="subst">$&#123;__dirname&#125;</span>/../iconfont.zip`</span>);</span><br><span class="line">    &#125;);</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<h3 id="源码"><a href="#源码" class="headerlink" title="源码"></a>源码</h3><p>okIcon<a href="https://github.com/1160007652/okIcon" target="_blank" rel="noopener">GitHub</a></p>
<figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br><span class="line">85</span><br><span class="line">86</span><br><span class="line">87</span><br><span class="line">88</span><br><span class="line">89</span><br><span class="line">90</span><br><span class="line">91</span><br><span class="line">92</span><br><span class="line">93</span><br><span class="line">94</span><br><span class="line">95</span><br><span class="line">96</span><br><span class="line">97</span><br><span class="line">98</span><br><span class="line">99</span><br><span class="line">100</span><br><span class="line">101</span><br><span class="line">102</span><br><span class="line">103</span><br><span class="line">104</span><br><span class="line">105</span><br><span class="line">106</span><br><span class="line">107</span><br><span class="line">108</span><br><span class="line">109</span><br><span class="line">110</span><br><span class="line">111</span><br><span class="line">112</span><br><span class="line">113</span><br><span class="line">114</span><br><span class="line">115</span><br><span class="line">116</span><br><span class="line">117</span><br><span class="line">118</span><br><span class="line">119</span><br><span class="line">120</span><br><span class="line">121</span><br><span class="line">122</span><br><span class="line">123</span><br><span class="line">124</span><br><span class="line">125</span><br><span class="line">126</span><br><span class="line">127</span><br><span class="line">128</span><br><span class="line">129</span><br><span class="line">130</span><br><span class="line">131</span><br><span class="line">132</span><br><span class="line">133</span><br><span class="line">134</span><br><span class="line">135</span><br><span class="line">136</span><br><span class="line">137</span><br><span class="line">138</span><br><span class="line">139</span><br><span class="line">140</span><br><span class="line">141</span><br><span class="line">142</span><br><span class="line">143</span><br><span class="line">144</span><br><span class="line">145</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">#!/usr/bin/env node</span></span><br><span class="line"></span><br><span class="line"><span class="keyword">const</span> fs = <span class="built_in">require</span>(<span class="string">'fs'</span>);</span><br><span class="line"><span class="keyword">const</span> fse = <span class="built_in">require</span>(<span class="string">'fs-extra'</span>);</span><br><span class="line"><span class="keyword">const</span> program = <span class="built_in">require</span>(<span class="string">'commander'</span>);</span><br><span class="line"><span class="keyword">const</span> inquirer = <span class="built_in">require</span>(<span class="string">'inquirer'</span>);</span><br><span class="line"><span class="keyword">const</span> request = <span class="built_in">require</span>(<span class="string">'request'</span>);</span><br><span class="line"><span class="keyword">const</span> logSymbols = <span class="built_in">require</span>(<span class="string">'log-symbols'</span>);</span><br><span class="line"><span class="keyword">const</span> chalk = <span class="built_in">require</span>(<span class="string">'chalk'</span>);</span><br><span class="line"><span class="keyword">const</span> spawn = <span class="built_in">require</span>(<span class="string">'cross-spawn'</span>);</span><br><span class="line"><span class="keyword">const</span> walk = <span class="built_in">require</span>(<span class="string">'walk'</span>);</span><br><span class="line"></span><br><span class="line"><span class="keyword">const</span> configPath = <span class="string">`<span class="subst">$&#123;__dirname&#125;</span>/../config.ini`</span>;</span><br><span class="line"></span><br><span class="line">program.version(<span class="string">'1.0.0'</span>, <span class="string">'-v, --version'</span>)</span><br><span class="line">    .option(<span class="string">'-i, --init'</span>, <span class="string">'初始化配置文件'</span>)</span><br><span class="line">    .option(<span class="string">'-d, --download'</span>, <span class="string">'下载iconfont文件'</span>)</span><br><span class="line">    .description(<span class="string">'自动下载IconFont助手'</span>);</span><br><span class="line"></span><br><span class="line">program.on(<span class="string">'--help'</span>, <span class="function"><span class="keyword">function</span>(<span class="params"></span>)</span>&#123;</span><br><span class="line">    <span class="built_in">console</span>.log(<span class="string">'\n-------------------------------------\n'</span>);</span><br><span class="line">    <span class="built_in">console</span>.log(<span class="string">'先使用 okIcon -i 进行初始化\n'</span>);</span><br><span class="line">    <span class="built_in">console</span>.log(<span class="string">"后续iconfont的改动，使用 okIcon -d 进行下载\n"</span>);</span><br><span class="line">&#125;);</span><br><span class="line">    </span><br><span class="line">program.parse(process.argv);</span><br><span class="line"></span><br><span class="line"><span class="keyword">if</span>(program.init)&#123;</span><br><span class="line">    inquirer.prompt([&#123;</span><br><span class="line">        type: <span class="string">'input'</span>,</span><br><span class="line">        name: <span class="string">'iconAddr'</span>,</span><br><span class="line">        message: <span class="string">'请输入iconfont的项目下载地址:\n'</span></span><br><span class="line">    &#125;,</span><br><span class="line">    &#123;</span><br><span class="line">        type: <span class="string">'input'</span>,</span><br><span class="line">        name: <span class="string">'iconCookies'</span>,</span><br><span class="line">        message: <span class="string">'请输入iconfont的Cookies:\n'</span></span><br><span class="line">    &#125;,</span><br><span class="line">    &#123;</span><br><span class="line">        type: <span class="string">'input'</span>,</span><br><span class="line">        name: <span class="string">'iconPath'</span>,</span><br><span class="line">        message: <span class="string">'请输入保存iconfont的绝对路径:\n'</span></span><br><span class="line">    &#125;]).then(<span class="function">(<span class="params">answers</span>) =&gt;</span> &#123;</span><br><span class="line">        <span class="keyword">const</span> &#123;iconAddr,iconCookies,iconPath&#125; = answers;</span><br><span class="line">        <span class="keyword">if</span>(setIconInfo(iconAddr,iconCookies,iconPath))&#123;</span><br><span class="line">            <span class="built_in">console</span>.log(logSymbols.success, chalk.green(<span class="string">'设置完毕，开始下载'</span>));</span><br><span class="line">            getIconfont();</span><br><span class="line">        &#125; <span class="keyword">else</span> &#123;</span><br><span class="line">            <span class="built_in">console</span>.log(logSymbols.error, chalk.red(<span class="string">'设置失败,再试一次'</span>));</span><br><span class="line">        &#125;</span><br><span class="line">    &#125;);</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="keyword">if</span>(program.download)&#123;</span><br><span class="line">    getIconfont();</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="function"><span class="keyword">function</span> <span class="title">getIconfont</span>(<span class="params"></span>) </span>&#123;</span><br><span class="line">    </span><br><span class="line">    <span class="comment">// iconfont 下载配置文件</span></span><br><span class="line">    <span class="keyword">let</span> configData = <span class="literal">null</span>;</span><br><span class="line"></span><br><span class="line">    <span class="comment">//创建存放 iconfont 解压数据的临时目录</span></span><br><span class="line">    fse.ensureDirSync(<span class="string">`<span class="subst">$&#123;__dirname&#125;</span>/../temp`</span>);</span><br><span class="line"></span><br><span class="line">    <span class="comment">// 判断文件是否存在</span></span><br><span class="line">    <span class="keyword">try</span> &#123;</span><br><span class="line">       <span class="keyword">if</span>(fs.existsSync(configPath) &amp;&amp; fs.existsSync(<span class="string">`<span class="subst">$&#123;__dirname&#125;</span>/../temp`</span>))&#123;</span><br><span class="line">            <span class="keyword">try</span> &#123;</span><br><span class="line">                configData = <span class="built_in">JSON</span>.parse(fs.readFileSync(configPath));</span><br><span class="line">            &#125; <span class="keyword">catch</span> (error) &#123;</span><br><span class="line">                <span class="built_in">console</span>.log(logSymbols.warning, chalk.yellow(<span class="string">'读取配置文件失败'</span>));</span><br><span class="line">            &#125;</span><br><span class="line">       &#125; <span class="keyword">else</span> &#123;</span><br><span class="line">            <span class="built_in">console</span>.log(logSymbols.info, <span class="string">"还未初始化,请执行"</span>, chalk.blue(<span class="string">' okIcon -i'</span>));</span><br><span class="line">            <span class="built_in">console</span>.log(<span class="string">""</span>);</span><br><span class="line">            <span class="keyword">return</span>;</span><br><span class="line">       &#125;</span><br><span class="line">    &#125; <span class="keyword">catch</span> (error) &#123;</span><br><span class="line">        <span class="built_in">console</span>.log(logSymbols.info, <span class="string">"还未初始化,请执行"</span>, chalk.blue(<span class="string">' okIcon -i'</span>));</span><br><span class="line">        <span class="keyword">return</span>;</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    <span class="comment">// 同步从阿里获取 iconfont</span></span><br><span class="line">    requestSync(configData.iconAddr, configData.iconCookies).then(<span class="function"><span class="params">()</span>=&gt;</span>&#123;</span><br><span class="line"></span><br><span class="line">        <span class="comment">// 解压iconfont configData.iconPath</span></span><br><span class="line">        spawn.sync(<span class="string">'tar'</span>, [<span class="string">'zxf'</span>, <span class="string">`<span class="subst">$&#123;__dirname&#125;</span>/../iconfont.zip`</span>, <span class="string">'-C'</span>, <span class="string">`<span class="subst">$&#123;__dirname&#125;</span>/../temp`</span>], &#123; <span class="attr">stdio</span>: <span class="string">'inherit'</span> &#125;);</span><br><span class="line">        </span><br><span class="line">        moveIconfont(configData.iconPath);</span><br><span class="line">    &#125;);</span><br><span class="line">    </span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="function"><span class="keyword">function</span> <span class="title">setIconInfo</span>(<span class="params">iconAddr,iconCookies,iconPath</span>)</span>&#123;</span><br><span class="line">    <span class="keyword">const</span> source = &#123; iconAddr, iconCookies, iconPath &#125;</span><br><span class="line">    <span class="keyword">try</span> &#123;</span><br><span class="line">        <span class="keyword">const</span> s = fs.writeFileSync(configPath, <span class="built_in">JSON</span>.stringify(source));</span><br><span class="line">        <span class="keyword">return</span> <span class="literal">true</span>;</span><br><span class="line">    &#125; <span class="keyword">catch</span> (error) &#123;</span><br><span class="line">        <span class="keyword">return</span> <span class="literal">false</span>;</span><br><span class="line">    &#125;  </span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="function"><span class="keyword">function</span> <span class="title">requestSync</span>(<span class="params">url, cookies</span>) </span>&#123;</span><br><span class="line">    <span class="keyword">return</span> <span class="keyword">new</span> <span class="built_in">Promise</span>(<span class="function"><span class="keyword">function</span>(<span class="params">resolve, reject</span>)</span>&#123;</span><br><span class="line">        <span class="keyword">let</span> options = &#123;</span><br><span class="line">            url: url,</span><br><span class="line">            headers: &#123;</span><br><span class="line">            <span class="string">'User-Agent'</span>: <span class="string">`Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36`</span>,</span><br><span class="line">            Cookie: cookies</span><br><span class="line">            &#125;</span><br><span class="line">        &#125;;</span><br><span class="line"></span><br><span class="line">        request(options,<span class="function"><span class="keyword">function</span>(<span class="params">e,r,b</span>)</span>&#123;</span><br><span class="line">            <span class="keyword">if</span>(e)&#123;</span><br><span class="line">                reject(e);</span><br><span class="line">            &#125;<span class="keyword">else</span>&#123;</span><br><span class="line">                resolve(b);</span><br><span class="line">            &#125;</span><br><span class="line">        &#125;).pipe(fs.createWriteStream(<span class="string">`<span class="subst">$&#123;__dirname&#125;</span>/../iconfont.zip`</span>));</span><br><span class="line">    &#125;);</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="function"><span class="keyword">function</span> <span class="title">moveIconfont</span>(<span class="params">iconPath</span>)</span>&#123;</span><br><span class="line">    <span class="keyword">const</span> walker = walk.walk(<span class="string">`<span class="subst">$&#123;__dirname&#125;</span>/../temp`</span>);</span><br><span class="line">    <span class="keyword">const</span> iconFiles = [<span class="string">'iconfont.css'</span>, <span class="string">'iconfont.eot'</span>, <span class="string">'iconfont.js'</span>, <span class="string">'iconfont.svg'</span>, <span class="string">'iconfont.ttf'</span>, <span class="string">'iconfont.woff'</span>];</span><br><span class="line">    walker.on(<span class="string">"file"</span>, <span class="function"><span class="keyword">function</span>(<span class="params">root, fileStats, next</span>)</span>&#123;</span><br><span class="line">        <span class="keyword">if</span> (iconFiles.includes(fileStats.name))&#123;</span><br><span class="line">            fse.moveSync(<span class="string">`<span class="subst">$&#123;root&#125;</span>/<span class="subst">$&#123;fileStats.name&#125;</span>`</span>, <span class="string">`<span class="subst">$&#123;iconPath&#125;</span>/<span class="subst">$&#123;fileStats.name&#125;</span>`</span>, &#123; <span class="attr">overwrite</span>: <span class="literal">true</span> &#125;);</span><br><span class="line">        &#125;</span><br><span class="line">        next();</span><br><span class="line">    &#125;);</span><br><span class="line"></span><br><span class="line">    walker.on(<span class="string">"errors"</span>, <span class="function"><span class="keyword">function</span> (<span class="params">root, nodeStatsArray, next</span>) </span>&#123;</span><br><span class="line">        next();</span><br><span class="line">    &#125;);</span><br><span class="line">    </span><br><span class="line">    walker.on(<span class="string">"end"</span>, <span class="function"><span class="keyword">function</span> (<span class="params"></span>) </span>&#123;</span><br><span class="line">        <span class="built_in">console</span>.log(logSymbols.success, chalk.green(<span class="string">"下载完毕"</span>));</span><br><span class="line">        fse.removeSync(<span class="string">`<span class="subst">$&#123;__dirname&#125;</span>/../temp`</span>);</span><br><span class="line">        fse.removeSync(<span class="string">`<span class="subst">$&#123;__dirname&#125;</span>/../iconfont.zip`</span>);</span><br><span class="line">    &#125;);</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
      
    </div>

    
      


    

    
      
    

    
    
    

    

    
      
    
    

    
      <div>
        




  



<ul class="post-copyright">
  <li class="post-copyright-author">
    <strong>本文作者： </strong>修心</li>
  <li class="post-copyright-link">
    <strong>本文链接：</strong>
    
    <a href="https://blog.youngzk.com/posts/5da3d5f3/" title="okcoin-cli 辅助">https://blog.youngzk.com/posts/5da3d5f3/</a>
  </li>
  <li class="post-copyright-license">
    <strong>版权声明： </strong>本博客所有文章除特别声明外，均采用 <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/zh-CN" rel="noopener" target="_blank"><i class="fa fa-fw fa-creative-commons"></i>BY-NC-SA</a> 许可协议。转载请注明出处！</li>
</ul>

      </div>
    

    <footer class="post-footer">
      
        
          
        
        <div class="post-tags">
          
            <a href="/tags/cli/" rel="tag"># cli</a>
          
            <a href="/tags/npm/" rel="tag"># npm</a>
          
            <a href="/tags/iconfont/" rel="tag"># iconfont</a>
          
        </div>
      

      
      
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
              <a href="/posts/554d6708/" rel="next" title="Electron-cer 跨平台证书安装">
                <i class="fa fa-chevron-left"></i> Electron-cer 跨平台证书安装
              </a>
            
          </div>

          <span class="post-nav-divider"></span>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/posts/5fbecc6/" rel="prev" title="Thinkphp-5.0 GetShell">
                Thinkphp-5.0 GetShell <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </div>
  
  
  
  </article>

  </div>


          </div>
          
  



        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap">
            文章目录
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview-wrap">
            站点概览
          </li>
        </ul>
      

      <div class="site-overview-wrap sidebar-panel">
        <div class="site-overview">

          <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
  
    <a href="/">
      <img class="site-author-image" itemprop="image" src="/images/avatar.jpg" alt="修心">
      </a>
  
  <p class="site-author-name" itemprop="name">修心</p>
  <div class="site-description motion-element" itemprop="description">修不被别人影响的心，修不被自己控制的心，修不被别人诱惑的心。</div>
</div>


  <nav class="site-state motion-element">
    
      <div class="site-state-item site-state-posts">
        
          <a href="/archives/">
        
          <span class="site-state-item-count">17</span>
          <span class="site-state-item-name">日志</span>
        </a>
      </div>
    

    
      
      
      <div class="site-state-item site-state-categories">
        
          
            <a href="/categories/">
          
        
        
        
          
        
          
        
          
        
        <span class="site-state-item-count">3</span>
        <span class="site-state-item-name">分类</span>
        </a>
      </div>
    

    
      
      
      <div class="site-state-item site-state-tags">
        
          
            <a href="/tags/">
          
        
        
        
          
        
          
        
          
        
          
        
          
        
          
        
          
        
          
        
          
        
          
        
          
        
          
        
          
        
          
        
          
        
          
        
          
        
          
        
          
        
          
        
        <span class="site-state-item-count">20</span>
        <span class="site-state-item-name">标签</span>
        </a>
      </div>
    
  </nav>







  <div class="links-of-author motion-element">
    
      <span class="links-of-author-item">
      
      
        
      
      
        
      
        <a href="https://github.com/1160007652" title="GitHub &rarr; https://github.com/1160007652" rel="noopener" target="_blank"><i class="fa fa-fw fa-github"></i>GitHub</a>
      </span>
    
      <span class="links-of-author-item">
      
      
        
      
      
        
      
        <a href="mailto:1160007652@qq.com" title="E-Mail &rarr; mailto:1160007652@qq.com" rel="noopener" target="_blank"><i class="fa fa-fw fa-envelope"></i>E-Mail</a>
      </span>
    
  </div>



  <div class="cc-license motion-element" itemprop="license">
  
  
    
  
  
  
    <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/zh-CN" class="cc-opacity" rel="noopener" target="_blank"><img src="/images/cc-by-nc-sa.svg" alt="Creative Commons"></a>
  </div>





          
          
        </div>
      </div>

      
      <!--noindex-->
        <div class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">

            
            
            
            

            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-3"><a class="nav-link" href="#okIcon"><span class="nav-number">1.</span> <span class="nav-text">okIcon</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#使用的模块"><span class="nav-number">1.1.</span> <span class="nav-text">使用的模块</span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#制作okcoin"><span class="nav-number">2.</span> <span class="nav-text">制作okcoin</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#接收命令行参数"><span class="nav-number">2.1.</span> <span class="nav-text">接收命令行参数</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#交互式操作"><span class="nav-number">2.2.</span> <span class="nav-text">交互式操作</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#ruquest携带自定义cookie"><span class="nav-number">2.3.</span> <span class="nav-text">ruquest携带自定义cookie</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#文件遍历封装"><span class="nav-number">2.4.</span> <span class="nav-text">文件遍历封装</span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#源码"><span class="nav-number">3.</span> <span class="nav-text">源码</span></a></li></ol></div>
            

          </div>
        </div>
      <!--/noindex-->
      

      

    </div>
  </aside>
  <div id="sidebar-dimmer"></div>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright">&copy; 2018 – <span itemprop="copyrightYear">2019</span>
  <span class="with-love" id="animate">
    <i class="fa fa-user"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">修心</span>

  

  
</div>

<div>
  修不被别人影响的心，修不被自己控制的心，修不被别人诱惑的心。
</div>









        
<div class="busuanzi-count">
  <script async src="https://busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>

  
    <span class="post-meta-item-icon">
      <i class="fa fa-user"></i>
    </span>
    <span class="site-uv" title="总访客量">
      <span class="busuanzi-value" id="busuanzi_value_site_uv"></span>
    </span>
  

  
    <span class="post-meta-divider">|</span>
  

  
    <span class="post-meta-item-icon">
      <i class="fa fa-eye"></i>
    </span>
    <span class="site-pv" title="总访问量">
      <span class="busuanzi-value" id="busuanzi_value_site_pv"></span>
    </span>
  
</div>









        
      </div>
    </footer>

    
      <div class="back-to-top">
        <i class="fa fa-arrow-up"></i>
        
          <span id="scrollpercent"><span>0</span>%</span>
        
      </div>
    

    

    

    

  </div>

  

<script>
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>






  











  
  









  
  <script src="/lib/jquery/index.js?v=3.4.1"></script>

  
  <script src="/lib/fancybox/source/jquery.fancybox.pack.js"></script>

  
  <script src="/lib/velocity/velocity.min.js?v=1.2.1"></script>

  
  <script src="/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>




  <script src="/js/utils.js?v=7.2.0"></script>

  <script src="/js/motion.js?v=7.2.0"></script>



  
  


  <script src="/js/affix.js?v=7.2.0"></script>

  <script src="/js/schemes/pisces.js?v=7.2.0"></script>



  
  <script src="/js/scrollspy.js?v=7.2.0"></script>
<script src="/js/post-details.js?v=7.2.0"></script>



  <script src="/js/next-boot.js?v=7.2.0"></script>

  

  

  


  













  <script src="/js/local-search.js?v=7.2.0"></script>












<script>
// GET RESPONSIVE HEIGHT PASSED FROM IFRAME

window.addEventListener("message", function(e) {
  var data = e.data;
  if ((typeof data === 'string') && (data.indexOf('ciu_embed') > -1)) {
    var featureID = data.split(':')[1];
    var height = data.split(':')[2];
    $(`iframe[data-feature=${featureID}]`).height(parseInt(height) + 30);
  }
}, false);
</script>








  

<script src="/live2dw/lib/L2Dwidget.min.js?094cbace49a39548bed64abff5988b05"></script><script>L2Dwidget.init({"pluginRootPath":"live2dw/","pluginJsPath":"lib/","pluginModelPath":"assets/","tagMode":false,"debug":false,"model":{"jsonPath":"/live2dw/assets/hijiki.model.json"},"display":{"position":"right","width":150,"height":300},"mobile":{"show":true},"react":{"opacity":0.7},"log":false});</script></body>
</html>
